﻿@model IEnumerable<Web.Areas.Admin.Models.Stylist>

@{
    ViewBag.Title = "名师展示";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

@section header{
<style type="text/css">
    .gridColCheck{width:10%;}
    </style>
    <script type="text/javascript">
        $(function () {
            $("input[type='radio']").each(function () {
                $(this).click(function () {
                    $("#btnEdit").attr("href", "/Admin/Stylist/Edit/" + $(this).attr("value"));
                    $("#btnDel").attr("href", "/Admin/Stylist/Del/" + $(this).attr("value"));
                });
            });
        });
        function cusval() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return true;
            }
        }
        function cusDel() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return confirm('你确定要删除么？');
            }
        }
    </script>
}
<div class="nav">当前位置 :-> 名师推荐</div>
<div class="toolbar">
    @Html.ActionLink("添加", "Add", "Stylist", new { area = "Admin" }, null)
    @Html.ActionLink("编辑", "Edit", "Stylist", new { area = "Admin" }, new { @id = "btnEdit", onclick = "return cusval()" })
    @Html.ActionLink("删除", "Del", "Stylist", new { area = "Admin" }, new { @id = "btnDel", onclick = "return cusDel()" })
    @Html.ActionLink("刷新", "Index", "Stylist", new { area = "Admin" }, null)
</div>
<div class="searchbar">
    @using (Html.BeginForm()) {
    @Html.Label("tbxSearchStylistID", "名师编号：") @Html.TextBox("tbxSearchStylistID", "")
    @Html.Label("tbxSearchStylistName", "名师名称：") @Html.TextBox("tbxSearchStylistName", "")
    @Html.Label("tbxSearchStylistTel", "联系方式：") @Html.TextBox("tbxSearchStylistTel", "")<br /> 
    @Html.Label("tbxSearchStylistShopName", "所属门店：") @Html.TextBox("tbxSearchStylistShopName", "")   
    @Html.Label("tbxSearchStylistTypeName", "名师类别：") @Html.TextBox("tbxSearchStylistTypeName", "")
    @Html.Label("tbxSearchIsValid", "是否有效：") @Html.TextBox("tbxSearchIsValid", "")<br />
    @Html.Label("tbxSearchIsTop", "首页显示：") @Html.TextBox("tbxSearchIsTop", "")
    <input type="submit" value="搜索" />
    }
</div>
<hr />
@{var grid = new WebGrid(source: Model, defaultSort: "StylistID", rowsPerPage: 10);}

@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
htmlAttributes: new { width = "100%" },
columns: grid.Columns(
grid.Column(format: @<text><input type="radio" name="rdoStylist" value="@item.StylistID" /></text>),
                grid.Column("StylistID", "编号"),
                grid.Column("StylistName", "名师名称", format: @<text><span title="@item.StylistName">@Html.FormatStr((string)item.StylistName, 10)</span></text>),
                                    grid.Column("StylistTel", "联系方式"),
                                            grid.Column("StylistShopName", "所属门店"),
                                            grid.Column("StylistTypeName", "名师类别"),
                                                                grid.Column("IsTop", "首页显示"),
                    grid.Column("IsValid","是否生效")
)
)

